class Solution(object):
    def isIsomorphic(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: bool
        """
        if len(s) != len(t):
            return False

        s_logs = {}
        t_logs = {}

        for (i, c) in enumerate(s):
            tc = t[i]

            if ((c in s_logs) and (s_logs[c] != tc)) \
                or ((tc in t_logs) and (t_logs[tc] != c)):
                return False
            else:
                s_logs[c] = tc
                t_logs[tc] = c

            s = s.replace(c, t[i])

        return True

s = Solution()
print(s.isIsomorphic("ab", "aa")) # False
print(s.isIsomorphic("egg", "add"))
print(s.isIsomorphic("foo", "bar"))
print(s.isIsomorphic("paper", "title"))
print(s.isIsomorphic("\\", "\\"))
print(s.isIsomorphic("qwertyuiop[]asdfghjkl;'\\zxcvbnm,./", "',.pyfgcrl/=aoeuidhtns-\\;qjkxbmwvz"))